package corewarsxxi.logic.throwables;

/**
 * The RedCode language contains several instructions that perform jumps.
 * <p>This class should be used only by instructions, and not elsewhere.</p>
 * @version 1.0
 * @see     corewarsxxi.logic.jmp
 * @see     corewarsxxi.logic.jmz
 * @see     corewarsxxi.logic.jmn
 * @see     corewarsxxi.logic.djn
 * @author  Luís Fonseca, ei10139 @ FEUP
 */
public class processJump extends Throwable {
    /** The offset which the jump is to be made.*/
    public int offset;

    /** Is the jump Relative or Absolute.*/
    public boolean relative;

    /**
     * Public constructor of processJump which accepts the offset.
     * @param offset    offset to jump to
     * @param relative  is the offset relative or absolute?
     */
    public processJump(int offset, boolean relative)
    {
        this.relative = relative;
        this.offset = offset;
    }

    /**
     * Public constructor of processJump which assumes the offset given is relative.
     * @param offset    offset to jump to
     */
    public processJump(int offset)
    {
        this(offset, true);
    }
}
